var voiceToArr = [];
var voiceHasArr = [];
var voices = [];
function playVoice() {
    if(voiceToArr.length > 0){
        var msg = voiceToArr[0];
        console.log(msg, "VoiceMsg");
        var toSpeak = new SpeechSynthesisUtterance(msg);
        toSpeak.rate = 1.2;// 设置播放语速，范围：0.1 - 10之间
        toSpeak.volume = 1;
        var voices = window.speechSynthesis.getVoices();
        toSpeak.voice = voices[0];
        window.speechSynthesis.speak(toSpeak);
        voiceHasArr.push(msg);
        voiceToArr.splice(0, 1);
    }
}
function clearVoices(){
    voiceToArr = [];voiceHasArr = [];
}
function reloadVoices(){
    voices = window.speechSynthesis.getVoices();
    console.log(voices.length, "load voices");
}
